<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML Form Support</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="libsoup Reference Manual">
<link rel="up" href="ch04.html" title="Web Services APIs">
<link rel="prev" href="ch04.html" title="Web Services APIs">
<link rel="next" href="libsoup-2.4-XMLRPC-Support.html" title="XMLRPC Support">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="ch04.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch04.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libsoup Reference Manual</th>
<td><a accesskey="n" href="libsoup-2.4-XMLRPC-Support.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libsoup-2.4-HTML-Form-Support.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#libsoup-2.4-HTML-Form-Support.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="libsoup-2.4-HTML-Form-Support"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libsoup-2.4-HTML-Form-Support.top_of_page"></a>HTML Form Support</span></h2>
<p>HTML Form Support — HTML form handling</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="libsoup-2.4-HTML-Form-Support.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;libsoup/soup.h&gt;

#define             <a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-MULTIPART:CAPS" title="SOUP_FORM_MIME_TYPE_MULTIPART">SOUP_FORM_MIME_TYPE_MULTIPART</a>
#define             <a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-URLENCODED:CAPS" title="SOUP_FORM_MIME_TYPE_URLENCODED">SOUP_FORM_MIME_TYPE_URLENCODED</a>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="returnvalue">GHashTable</span></a> *        <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode" title="soup_form_decode ()">soup_form_decode</a>                    (<em class="parameter"><code>const <span class="type">char</span> *encoded_form</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="returnvalue">GHashTable</span></a> *        <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()">soup_form_decode_multipart</a>          (<em class="parameter"><code><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> *msg</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *file_control_name</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **filename</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **content_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessageBody.html#SoupBuffer"><span class="type">SoupBuffer</span></a> **file</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()">soup_form_encode</a>                    (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()">soup_form_encode_datalist</a>           (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Keyed-Data-Lists.html#GData"><span class="type">GData</span></a> **form_data_set</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()">soup_form_encode_hash</a>               (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> *form_data_set</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-valist" title="soup_form_encode_valist ()">soup_form_encode_valist</a>             (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code><span class="type">va_list</span> args</code></em>);
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()">soup_form_request_new</a>               (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-datalist" title="soup_form_request_new_from_datalist ()">soup_form_request_new_from_datalist</a> (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Keyed-Data-Lists.html#GData"><span class="type">GData</span></a> **form_data_set</code></em>);
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-hash" title="soup_form_request_new_from_hash ()">soup_form_request_new_from_hash</a>     (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> *form_data_set</code></em>);
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-multipart" title="soup_form_request_new_from_multipart ()">soup_form_request_new_from_multipart</a>
                                                        (<em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a> *multipart</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.description"></a><h2>Description</h2>
<p>
libsoup contains several help methods for processing HTML forms as
defined by <a class="ulink" href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13" target="_top">the
HTML 4.01 specification</a>.
</p>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="SOUP-FORM-MIME-TYPE-MULTIPART:CAPS"></a><h3>SOUP_FORM_MIME_TYPE_MULTIPART</h3>
<pre class="programlisting">#define SOUP_FORM_MIME_TYPE_MULTIPART  "multipart/form-data"
</pre>
<p>
A macro containing the value
<code class="literal">"multipart/form-data"</code>; the MIME type used for
posting form data that contains files to be uploaded.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="SOUP-FORM-MIME-TYPE-URLENCODED:CAPS"></a><h3>SOUP_FORM_MIME_TYPE_URLENCODED</h3>
<pre class="programlisting">#define SOUP_FORM_MIME_TYPE_URLENCODED "application/x-www-form-urlencoded"
</pre>
<p>
A macro containing the value
<code class="literal">"application/x-www-form-urlencoded"</code>; the default
MIME type for POSTing HTML form data.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-decode"></a><h3>soup_form_decode ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="returnvalue">GHashTable</span></a> *        soup_form_decode                    (<em class="parameter"><code>const <span class="type">char</span> *encoded_form</code></em>);</pre>
<p>
Decodes <em class="parameter"><code>form</code></em>, which is an urlencoded dataset as defined in the
HTML 4.01 spec.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>encoded_form</code></em> :</span></p></td>
<td>data of type "application/x-www-form-urlencoded"</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a hash
table containing the name/value pairs from <em class="parameter"><code>encoded_form</code></em>, which you
can free with <a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#g-hash-table-destroy"><code class="function">g_hash_table_destroy()</code></a>. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-decode-multipart"></a><h3>soup_form_decode_multipart ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="returnvalue">GHashTable</span></a> *        soup_form_decode_multipart          (<em class="parameter"><code><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> *msg</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *file_control_name</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **filename</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> **content_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMessageBody.html#SoupBuffer"><span class="type">SoupBuffer</span></a> **file</code></em>);</pre>
<p>
Decodes the "multipart/form-data" request in <em class="parameter"><code>msg</code></em>; this is a
convenience method for the case when you have a single file upload
control in a form. (Or when you don't have any file upload
controls, but are still using "multipart/form-data" anyway.) Pass
the name of the file upload control in <em class="parameter"><code>file_control_name</code></em>, and
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()"><code class="function">soup_form_decode_multipart()</code></a> will extract the uploaded file data
into <em class="parameter"><code>filename</code></em>, <em class="parameter"><code>content_type</code></em>, and <em class="parameter"><code>file</code></em>. All of the other form
control data will be returned (as strings, as with
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode" title="soup_form_decode ()"><code class="function">soup_form_decode()</code></a>) in the returned <a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a>.
</p>
<p>
You may pass <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for <em class="parameter"><code>filename</code></em>, <em class="parameter"><code>content_type</code></em> and/or <em class="parameter"><code>file</code></em> if you do not
care about those fields. <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()"><code class="function">soup_form_decode_multipart()</code></a> may also
return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> in those fields if the client did not provide that
information. You must free the returned filename and content-type
with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>, and the returned file data with <a class="link" href="SoupMessageBody.html#soup-buffer-free" title="soup_buffer_free ()"><code class="function">soup_buffer_free()</code></a>.
</p>
<p>
If you have a form with more than one file upload control, you will
need to decode it manually, using <a class="link" href="SoupMultipart.html#soup-multipart-new-from-message" title="soup_multipart_new_from_message ()"><code class="function">soup_multipart_new_from_message()</code></a>
and <a class="link" href="SoupMultipart.html#soup-multipart-get-part" title="soup_multipart_get_part ()"><code class="function">soup_multipart_get_part()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>msg</code></em> :</span></p></td>
<td>a <a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> containing a "multipart/form-data" request body</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>file_control_name</code></em> :</span></p></td>
<td>the name of the HTML file upload control, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td>return location for the name of the uploaded file, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>content_type</code></em> :</span></p></td>
<td>return location for the MIME type of the uploaded file, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
<td>return location for the uploaded file data, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a hash
table containing the name/value pairs (other than
<em class="parameter"><code>file_control_name</code></em>) from <em class="parameter"><code>msg</code></em>, which you can free with
<a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#g-hash-table-destroy"><code class="function">g_hash_table_destroy()</code></a>. On error, it will return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8][<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode"></a><h3>soup_form_encode ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              soup_form_encode                    (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Encodes the given field names and values into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec.
</p>
<p>
This method requires you to know the names of the form fields (or
at the very least, the total number of fields) at compile time; for
working with dynamic forms, use <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()"><code class="function">soup_form_encode_hash()</code></a> or
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()"><code class="function">soup_form_encode_datalist()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_field</code></em> :</span></p></td>
<td>name of the first form field</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>value of <em class="parameter"><code>first_field</code></em>, followed by additional field names
and values, terminated by <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the encoded form</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-datalist"></a><h3>soup_form_encode_datalist ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              soup_form_encode_datalist           (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Keyed-Data-Lists.html#GData"><span class="type">GData</span></a> **form_data_set</code></em>);</pre>
<p>
Encodes <em class="parameter"><code>form_data_set</code></em> into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec. Unlike <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()"><code class="function">soup_form_encode_hash()</code></a>, this preserves the ordering
of the form elements, which may be required in some situations.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>form_data_set</code></em> :</span></p></td>
<td>a datalist containing name/value pairs</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the encoded form</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-hash"></a><h3>soup_form_encode_hash ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              soup_form_encode_hash               (<em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> *form_data_set</code></em>);</pre>
<p>
Encodes <em class="parameter"><code>form_data_set</code></em> into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec.
</p>
<p>
Note that the HTML spec states that "The control names/values are
listed in the order they appear in the document." Since this method
takes a hash table, it cannot enforce that; if you care about the
ordering of the form fields, use <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()"><code class="function">soup_form_encode_datalist()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>form_data_set</code></em> :</span></p></td>
<td>a hash table containing
name/value pairs (as strings). <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the encoded form</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-valist"></a><h3>soup_form_encode_valist ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              soup_form_encode_valist             (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>
See <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()"><code class="function">soup_form_encode()</code></a>. This is mostly an internal method, used by
various other methods such as <a class="link" href="SoupURI.html#soup-uri-set-query-from-fields" title="soup_uri_set_query_from_fields ()"><code class="function">soup_uri_set_query_from_fields()</code></a> and
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_field</code></em> :</span></p></td>
<td>name of the first form field</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td>
<td>pointer to additional values, as in <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()"><code class="function">soup_form_encode()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the encoded form</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new"></a><h3>soup_form_request_new ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       soup_form_request_new               (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send the given data
to <em class="parameter"><code>uri</code></em> via <em class="parameter"><code>method</code></em>. (That is, if <em class="parameter"><code>method</code></em> is "GET", it will encode
the form data into <em class="parameter"><code>uri</code></em>'s query field, and if <em class="parameter"><code>method</code></em> is "POST", it
will encode it into the <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>'s request_body.)
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>method</code></em> :</span></p></td>
<td>the HTTP method, either "GET" or "POST"</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>the URI to send the form data to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>first_field</code></em> :</span></p></td>
<td>name of the first form field</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>value of <em class="parameter"><code>first_field</code></em>, followed by additional field names
and values, terminated by <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-datalist"></a><h3>soup_form_request_new_from_datalist ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       soup_form_request_new_from_datalist (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Keyed-Data-Lists.html#GData"><span class="type">GData</span></a> **form_data_set</code></em>);</pre>
<p>
Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>form_data_set</code></em> to
<em class="parameter"><code>uri</code></em> via <em class="parameter"><code>method</code></em>, as with <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>method</code></em> :</span></p></td>
<td>the HTTP method, either "GET" or "POST"</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>the URI to send the form data to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>form_data_set</code></em> :</span></p></td>
<td>the data to send to <em class="parameter"><code>uri</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-hash"></a><h3>soup_form_request_new_from_hash ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       soup_form_request_new_from_hash     (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Hash-Tables.html#GHashTable"><span class="type">GHashTable</span></a> *form_data_set</code></em>);</pre>
<p>
Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>form_data_set</code></em> to
<em class="parameter"><code>uri</code></em> via <em class="parameter"><code>method</code></em>, as with <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>method</code></em> :</span></p></td>
<td>the HTTP method, either "GET" or "POST"</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>the URI to send the form data to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>form_data_set</code></em> :</span></p></td>
<td>the data to send to <em class="parameter"><code>uri</code></em>. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-multipart"></a><h3>soup_form_request_new_from_multipart ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *       soup_form_request_new_from_multipart
                                                        (<em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                                         <em class="parameter"><code><a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a> *multipart</code></em>);</pre>
<p>
Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>multipart</code></em> to
<em class="parameter"><code>uri</code></em> via POST.
</p>
<p>
To send a <code class="literal">"multipart/form-data"</code> POST, first
create a <a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a>, using <a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-MULTIPART:CAPS" title="SOUP_FORM_MIME_TYPE_MULTIPART"><code class="literal">SOUP_FORM_MIME_TYPE_MULTIPART</code></a> as
the MIME type. Then use <a class="link" href="SoupMultipart.html#soup-multipart-append-form-string" title="soup_multipart_append_form_string ()"><code class="function">soup_multipart_append_form_string()</code></a> and
<a class="link" href="SoupMultipart.html#soup-multipart-append-form-file" title="soup_multipart_append_form_file ()"><code class="function">soup_multipart_append_form_file()</code></a> to add the value of each form
control to the multipart. (These are just convenience methods, and
you can use <a class="link" href="SoupMultipart.html#soup-multipart-append-part" title="soup_multipart_append_part ()"><code class="function">soup_multipart_append_part()</code></a> if you need greater
control over the part headers.) Finally, call
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-multipart" title="soup_form_request_new_from_multipart ()"><code class="function">soup_form_request_new_from_multipart()</code></a> to serialize the multipart
structure and create a <a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>uri</code></em> :</span></p></td>
<td>the URI to send the form data to</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>multipart</code></em> :</span></p></td>
<td>a "multipart/form-data" <a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.see-also"></a><h2>See Also</h2>
<a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>